package cn.tedu.shoot;

import java.awt.image.BufferedImage;

//子弹
public class Bullet extends FlyingObject{
    private int speed; //向下移动速度

    public Bullet(int x,int y){//子弹可以有多个，子弹的初始坐标要依赖于当前英雄机的坐标位置
        super(8,10,x,y);
        speed = 10;
    }

    public BufferedImage getImage() {
        if(isLive()){
            return Images.bullet;
        }else if(isDead()){
            state = REMOVE;
        }
        return null;
    }

    public void step(){
        y -= speed;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public boolean isOutOfBounds(){
        return y<=-height;
    }

}
